#include <DigiUSB.h>
#include "DigisparkOLEDM.h"
#include "KQM2801A.h"
void setup()
{
  oled.begin();
  oled.print(F("SENSOR"));
  oled.setCursor(0, 2);
  oled.print(F("INITIALIZING"));
  DigiUSB.begin();
  kqm2801a.begin();
}
void loop()
{
  DigiUSB.refresh();
  VOCDATA value;
  value = kqm2801a.get_data();
  if (value.ivalue >= 0)
  {
    oled.clear();
    oled.print(F(" VOC(PPM):"));
    oled.setCursor(90, 0);
    oled.print(value.ivalue);
    oled.setCursor(40, 2);
    oled.print(F("IMI OF HFUT"));
    DigiUSB.refresh();
    DigiUSB.write(value.bvalue[0]);
    DigiUSB.write(value.bvalue[1]);
    DigiUSB.refresh();
    DigiUSB.delay(30000);
  }

}
